/*******************************************************************
 *
 * Copyright (C), 2021-2022, LS, All rights reserved.
 *
 * Author      : 
 * Create Time : 2020-12-17
 * Version     : v0.1
 * Description : 
 *******************************************************************/
#ifndef _APP_DISPLAY_H_
#define _APP_DISPLAY_H_
 
/*----------------------------Head file----------------------------*/
#include "stdint.h"
#include "stdbool.h"
#include "hal_display.h"

/*----------------------------macro file---------------------------*/
#define app_disp_backlight_set			hal_disp_backlight_set
#define app_disp_init_state_get			hal_disp_init_state_get

#define SEG_A   0x08
#define SEG_B   0x04
#define SEG_C   0x02
#define SEG_D   0x01
#define SEG_E   0x10
#define SEG_F   0x40
#define SEG_G   0x20

#define SEG_A_1   0x08
#define SEG_B_1   0x04
#define SEG_C_1   0x02
#define SEG_D_1   0x01
#define SEG_E_1   0x10
#define SEG_F_1   0x40
#define SEG_G_1   0x20

#define CHAR_NULL   0xFF

#define NUM_MASK1   0x08
#define NUM_MASK2   0x80


/*----------------------------type define--------------------------*/
enum {
    NUM_NO_1 = 0,
    NUM_NO_2,
    NUM_NO_3,
    NUM_NO_4,
    NUM_NO_5,
    NUM_NO_6,
    NUM_NO_7,
    NUM_NO_8,
};

enum {
    SEG_CHAR_0 = 0,
    SEG_CHAR_1,
    SEG_CHAR_2,
    SEG_CHAR_3,
    SEG_CHAR_4,
    SEG_CHAR_5,
    SEG_CHAR_6,
    SEG_CHAR_7,
    SEG_CHAR_8,
    SEG_CHAR_9,
    SEG_CHAR_A,
    SEG_CHAR_C,
    SEG_CHAR_F,
    SEG_CHAR_P,
    SEG_CHAR_L,
    SEG_CHAR_o,
    SEG_CHAR_d,
    SEG_CHAR_N,
    SEG_CHAR_E,
    SEG_CHAR_MINUS,
    
    SEG_CHAR_MAX,
};

enum {
    ICON_BT = 0,
    ICON_BAT0,
    ICON_BAT1,
    ICON_BAT2,
    ICON_BAT3,
    ICON_MODE_FREE,
    ICON_MODE_COUNTDOWN_NUM,
    ICON_MODE_COUNTDOWN_TIME,
    ICON_DOT_MINS,
    ICON_DOT_SECS,
    ICON_MAX,
};

typedef struct{
    uint8_t seg1;
    uint8_t seg2;
}num_seg_t;

typedef struct{
    uint8_t seg_num;
    uint8_t mask;
}icon_seg_t;

/*----------------------------var define---------------------------*/

/*-------------------------func declaration------------------------*/
extern void app_disp_update(void);
extern void app_disp_hw_init(void);
extern void app_disp_hw_deinit(void);
extern void app_disp_all_pixel(void);
extern void app_disp_clear(void);

extern void app_disp_icon_set(uint8_t icon);
extern void app_disp_icon_clear(uint8_t icon);

extern void app_disp_burn_ing(void);
extern void app_disp_sn(uint8_t *sn, uint8_t len);
extern void app_disp_done(void);
extern void app_disp_pass(void);
extern void app_disp_fail(void);
extern void app_disp_ota_ing(uint8_t cnt);
extern void app_disp_batt_lo(void);
extern void app_disp_bt_icon(void);
extern void app_disp_batt_icon(void);
extern void app_disp_skip_data(void);
extern void app_disp_charge_state(bool clear);
extern void app_disp_batt_state(uint8_t level);
extern void app_disp_ble_icon_flash(bool reset);
extern void app_disp_low_bat_icon_flash(bool reset);
extern void app_disp_skip_data_flash(uint8_t time_cnt);
extern void app_disp_cnt_down_start_secs(uint16_t num);

extern void app_disp_loop(bool reset);

/*-----------------------------------------------------------------*/


#endif


